﻿@using KRM.Core
@model tblOrderItem
@{
    ViewBag.Title = "Add Parts InOrder Item";
    Layout = "~/Views/Shared/_PopupLayout.cshtml";
    var db = new KRMEntities();
    IEnumerable<tblTempRDMOrderItemPart> orderItemParts = ViewBag.OrderItemParts;
    var disputeid = ViewBag.disputeid;
    ViewBag.warehouseID = new SelectList(db.tblKRMWarehouses, "WarehouseID", "WarehouseName");
}

<div class="padding10">
    <p>@Model.ProductName - @Model.ProductOption @Model.ProductSubOptions</p>
    <div class="row-fluid">
        <div class="span5 border-padding10">
            <div class="row-fluid">
                <div class="span3">Warehouse</div>
                <div class="span5">
                    @Html.DropDownList("warehouseID", null, new { @class = "input-block-level" })
                </div>
                <div class="span2">Qty</div>
                <div class="span2">
                    <input type="number" class="input-block-level" id="qty" value="1" />
                </div>
            </div>
            <ul class="tabs tabs-inline tabs-top orderdetail-task-tabs">
                <li class="active">
                    <a href="#Spare" data-toggle="tab">Spare Part</a>
                </li>
                <li>
                    <a href="#Full" data-toggle="tab">Full Product Option</a>
                </li>
            </ul>

            <div class="tab-content padding tab-content-inline tab-content-bottom orderdetail-task-tabs-content">
                <div class="tab-pane active" id="Spare">
                    <form action="/orderview/searchparts" method="POST" class="margin0 fr-searchparts">
                        <p>Part Id or Part Name</p>
                        <div class="row-fluid">
                            <div class="span10">
                                <input type="text" class="input-block-level" name="part" />
                            </div>
                            <div class="span1 text-right">
                                <button class="btn"><i class="icon-search"></i></button>
                            </div>
                        </div>
                    </form>
                    <form action="/orderview/addpartstoorder" method="POST" class="fr-addparttoorder margin0">
                        <input type="hidden" name="disputeid" value="@disputeid"/>
                        <input type="hidden" name="orderitemid" value="@Model.OrderItemID"/>
                        <div class="border-padding10 lstcb-parts" style="height: 227px; overflow: auto; margin-bottom: 10px"></div>
                        <div class="row-fluid">
                            <div class="span5">
                                <button type="submit" class="btn btn-primary">Add to order item</button>
                            </div>
                            <div class="span4">
                                <label>
                                    <input type="checkbox" class="pull-left" style="margin-right: 5px" name="optionpart" value="True" />
                                    Optional Part
                                </label>
                            </div>
                        </div>
                    </form>
                </div>

                <div class="tab-pane" id="Full">
                    <form action="/orderview/searchparts" method="POST" class="margin0 fr-searchproduct">
                        <p>Product Id or Product name</p>
                        <div class="row-fluid">
                            <div class="span10">
                                <input type="text" class="input-block-level" name="product" />
                            </div>
                            <div class="span1 text-right">
                                <button class="btn"><i class="icon-search"></i></button>
                            </div>
                        </div>
                    </form>
                    <form action="/orderview/addproducttoorder" method="POST" class="fr-addproducttoorder margin0">
                        <input type="hidden" name="disputeid" value="@disputeid"/>
                        <input type="hidden" name="orderitemid" value="@Model.OrderItemID"/>
                        <div class="lstcb-product" style="height: 199px; overflow: auto;"></div>
                        <p>Product Option</p>
                        <p>
                            <select id="productoptionid" name="productoptionid" class="input-block-level"></select></p>
                        <div class="row-fluid">
                            <div class="span5">
                                <button type="submit" class="btn btn-primary">Add to order item</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <div class="span7 border-padding10">
            <p>Order item parts</p>
            <form action="/orderview/removepartsinaddform" method="POST" class="margin0 fr-orderitemspartsinaddform">
                <input type="hidden" name="orderitemid" value="@Model.OrderItemID"/>
                <div class="tbl-order-items-parts">
                    <table class="table table-bordered table-fix">
                        <thead>
                            <tr>
                                <th></th>
                                <th>PartName</th>
                                <th>DeliveryType</th>
                                <th>PartQuantity</th>
                                <th>PartID</th>
                                <th>SentStockID</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (var item in orderItemParts)
                            {
                                <tr>
                                    <td>
                                        <input type="checkbox" name="selectorderitempart" value="@item.TempRDMOrderItemPartID"/></td>
                                    <td>@item.PartName</td>
                                    <td>@item.DeliveryType</td>
                                    <td>@item.PartQuantity</td>
                                    <td>@item.PartID</td>
                                    <td></td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
                <p class="text-right margin0">
                    <button class="btn btn-danger" type="submit">Remove</button></p>
            </form>
        </div>
    </div>
</div>
